<?php
namespace dk\traits;

trait Adapter {
    public $request = [];
    public $response = [];
    
    public function getRequest(){
        return $this->request;
    }
    
    public function setRequest($key, $value = null){
        if(!$key){
            return null;
        }
        if(is_array($key)){
            $this->request = array_merge($key, $this->request);
        } else {
            $this->request[$key] = $value;
        }
    }
    
    public function setResponse($key, $value = null){
        if(!$key){
            return null;
        }
        if(is_array($key)){
            $this->response = array_merge($key, $this->response);
        } else {
            $this->response[$key] = $value;
        }
    }

    public function getResponse(){
        return $this->response;
    }
    
    public $stopBuid = false;
    public function isStopBuid(){
        return $this->stopBuid;
    }
    public function stopBuild(){
        $this->stopBuid = true;
    }
    
    public function getAdapter(){
        return new \dk\core\Adapter($this);
    }
}
